﻿
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[sproc_GetPositionRightList]') AND type in (N'P', N'PC'))
    DROP PROCEDURE [dbo].[sproc_GetPositionRightList];
GO
CREATE PROCEDURE [dbo].[sproc_GetPositionRightList]
    @Positionid int
/*

============================================================
功能:    得到职位的权限表
参数:
    @Positionid int        :    职位ID
============================================================

*/

AS
BEGIN
SET NOCOUNT ON

SELECT
        a.rule_id,
        f.proc_name,
        f.proc_desc,
        b.Position_name,
        d.classname,
        d.classid
    FROM
        UDS_Assign_Rule a
        inner join uds_Position b on a.Position_id = b.Position_id
        left outer join uds_class d on d.classid = a.team_id
        inner join uds_proc f on f.proc_id = a.act_id
    WHERE
        a.based_on = 1
        and b.Position_id = @Positionid
    ORDER BY a.rule_id


END
GO